// 用户类型
export interface User {
  id: number
  username: string
  email: string
  realName: string
  avatarUrl?: string
  role: 'ADMIN' | 'USER'
  userType: 'BASIC' | 'VIP' | 'ADMIN'  // 对应MySQL的user_type字段
  vipExpireTime?: string  // VIP过期时间
  status: 'ACTIVE' | 'DISABLED'
  storageQuota: number
  storageUsed: number
  createdAt: string
  updatedAt: string
}

// 文件信息类型
export interface FileInfo {
  id: number
  fileName: string
  originalName: string
  filePath: string
  fileSize: number
  fileHash: string
  fileSha256?: string
  mimeType?: string
  ownerId: number
  parentId?: number
  isDirectory: boolean
  isDeleted: boolean
  thumbnailPath?: string
  downloadCount?: number
  createdAt: string
  updatedAt: string
  thumbnailUrl?: string
  downloadUrl?: string
  canEdit?: boolean
  canDelete?: boolean
}

// API响应类型
export interface ApiResponse<T = any> {
  code: number
  message: string
  data: T
  timestamp: string
}

// 分页类型
export interface PageResult<T> {
  list: T[]
  total: number
  page: number
  size: number
}

// 登录请求类型
export interface LoginRequest {
  username: string
  password: string
  captcha?: string
  captchaId?: string
}

// 登录响应类型
export interface LoginResponse {
  token: string
  user: User
}

// 注册请求类型
export interface RegisterRequest {
  username: string
  email: string
  password: string
  realName?: string
}

// 文件上传类型
export interface UploadFile {
  file: File
  progress: number
  status: 'waiting' | 'uploading' | 'success' | 'error'
  response?: any
}

// 菜单项类型
export interface MenuItem {
  id: string
  title: string
  icon: string
  path?: string
  children?: MenuItem[]
}

// 面包屑类型
export interface BreadcrumbItem {
  id: number
  name: string
  parentId?: number
}

// 路由元信息类型扩展
declare module 'vue-router' {
  interface RouteMeta {
    title?: string
    requiresAuth?: boolean
    requiresAdmin?: boolean
    requiresVip?: boolean
  }
}
